<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page
	import="java.util.Map,java.util.Date,java.text.SimpleDateFormat;"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<fieldset>
	<legend> &nbsp;&nbsp;&nbsp;&nbsp; 模板设计器 </legend>
	<form class="form-horizontal"
		action='<%=request.getContextPath()%>/c?s=wf&o=${p }Tpl&key=${key}&isajax=1'
		class='<c:out value="${ model.m_attr_class }"/>' method="post"
		<c:out value="${ model.m_attr_other }"/>
		id='form-tpl'>
		<div id="tabpanel">
			<ul class="nav nav-tabs">
				<li class="active"><a href="#basic" data-toggle="tab">基本信息</a></li>
				<li><a href="#flow" data-toggle="tab">流程设计</a></li>
			</ul>

			<!-- Tab panes -->
			<div class="tab-content">
				<div class="tab-pane active" id="basic">
				<c:if test="${p eq 'edit' }">
				<input type="hidden" name="t_id" value="${e.t_id }" />
				</c:if>
					<div class="control-group">
						<label class="control-label">模板名称：</label>
						<div class="controls">
							<input type="text" name="t_title" id="" value='<c:if test="${p eq 'edit' }">${e.t_title }</c:if>'/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">发布状态：</label>
						<div class="controls">
							<select  name="t_status">
							<c:forEach var="s" items="${status }">
								<c:if test="${p eq 'edit' }">
								<option value="${s.k }" <c:if test="${e.t_status eq s.k }">selected='selected'</c:if>>${s.v }</option>
								</c:if> 
								<c:if test="${p eq 'add' }">
								<option value="${s.k }">${s.v }</option>
								</c:if> 
							</c:forEach>
							
							</select>
						</div>
					</div>
					
				</div>
				<div class="tab-pane" id="flow">
					<div id="widget">
						<ul class="items">
							<li class="ui-draggable"><div class="wf-start"><i class="icon-play"></i></div><p>启动节点</p></li>
							<li class="ui-draggable"><div class="wf-node"><i class="icon-file-alt"></i></div><p>过程节点</p></li>
							<li class="ui-draggable"><div class="wf-end"><i class="icon-stop"></i></div><p>结束节点</p></li>
						</ul>
						<div class="cl"></div>
						<div class="panel ui-droppable">
							<ul class="nodes">
							<c:if test="${p eq 'edit' }">
							<li><div class="wf-start"><i class="icon-play"></i></div></li>
							<li> <div class="wf-right"><i class="icon-arrow-right"></i></div></li>
							<c:forEach var="n" items="${nodes }">
							<li flag="1" title="${n.n_title }" remark="${n.n_remark }" obs="${ n.n_cur_obs}" n_id="${n.n_id }" code="${n.n_code }" prev_code="${n.n_prev_code }">
								<div class="wf-node"><span><i class="icon-remove"></i></span><i class="icon-file-alt set"></i></div><p class="set">${n.n_title }</p>
							</li>
							<li> <div class="wf-right"><i class="icon-arrow-right"></i></div></li>
							</c:forEach>
							<li><div class="wf-end"><i class="icon-stop"></i></div></li>
							</c:if>
							</ul>
						</div>
						<div class="cl"></div>
					</div>
				</div>
			</div>
		</div>
		<div class="form-actions">
			<button class="btn btn-primary" o="${p }" type="button">
				<i class="icon-save"></i> <span>保存</span>
			</button>
			<%--
			<button class="btn btn-back">
				<i class="icon-reply"></i> <span>返回</span>
			</button> --%>
		</div>
	</form>
</fieldset>
<!-- Modal -->
<div class="modal fade" id="nodeEditForm" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">节点编辑</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal">
					<div class="control-group">
						<label class="control-label">节点名称：</label>
						<div class="controls">
							<input type="text" name="title" id="" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">审批部门：</label>
						<div class="controls">
							<select  name="obs">
								<option value="0" selected='selected'>请选择部门</option>
							<c:forEach var="o" items="${obs }">
								<option value="${o.o_id }">${o.o_name }</option>
							</c:forEach>
							
							</select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">节点备注：</label>
						<div class="controls">
							<textarea name="remark" id="" rows="5"></textarea>
						</div>
					</div>
					<div style="text-align:center;">
						<button class="btn btn-primary btn-lg" type="button"><i class="icon-ok"></i> 确 定</button>
						<button class="btn btn-danger btn-lg" type="reset"><i class="icon-reply"></i> 重 置</button>
					</div>
				</form>
				
				
			</div>
			
		</div> <!-- /.modal-content -->
	</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->

<script type="text/javascript">
<c:if test="${p eq 'add' }">
	$("#widget").wfdesign({'url':"<%=request.getContextPath()%>/c?s=wf&o="});
</c:if>
<c:if test="${p eq 'edit' }">
$("#widget").wfdesign({'url':"<%=request.getContextPath()%>/c?s=wf&o=",
		'tpl_id':${e.t_id} 
});
</c:if>
</script>